using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;


namespace Sublimation
{
    public abstract class GameObject : Microsoft.Xna.Framework.DrawableGameComponent
    {
        protected Vector2 position;
        public Vector2 Position
        {
            get { return this.position; }
            set { this.position = value; }
        }
        protected float rotation;
        public float Rotation
        {
            get { return this.rotation; }
            set { this.rotation = value; }
        }
        // Enabled bool if update should be called
        // Visible bool if draw should be called
        // UpdateOrder and DrawOrder to determine timing
        protected Vector2 velocity;
        public Vector2 Velocity
        {
            get { return this.velocity; }
            set { this.velocity = value; }
        }
        protected Texture2D sprite;
        public Texture2D Sprite
        {
            get { return this.sprite; }
            set
            {
                this.sprite = value;
                this.spriteRectangle = new Rectangle(0, 0, Sprite.Width, Sprite.Height);
            }
        }
        protected Rectangle spriteRectangle;
        public Rectangle SpriteRectangle
        {
            get { return this.spriteRectangle; }
        }

        public GameObject(Game game)
            : base(game)
        {
            Game.Components.Add(this);
        }

        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
        }

        protected override void LoadContent()
        {
            base.LoadContent();

            // Setup a SpriteBatch for this set of rendering
            spriteBatch = new SpriteBatch(Game.GraphicsDevice);
        }

        SpriteBatch spriteBatch;
        public override void Draw(GameTime gameTime)
        {
            spriteBatch.Begin(SpriteBlendMode.AlphaBlend);
            spriteBatch.Draw(
                Sprite,
                Position,
                SpriteRectangle,
                Color.White);
            spriteBatch.End();

            base.Draw(gameTime);
        }
    }
}